<?php
	session_start();
	include '../common/db.inc';
	$conn = new mysqli($host, $username, $password, $dbname);	
	$conn->query("set names 'utf8'");	
	if (mysqli_connect_errno()) {
	    printf("Connect failed: %s\n", mysqli_connect_error());
	    exit();
	}
	$id = $_SESSION["user_id"];
	$strSQL = "call sp_DeleteUserOnlineById('$id')";
	$result = $conn->query($strSQL);
	$conn->close();
	
	if(isset($_SESSION['user_id']))
		unset($_SESSION['user_id']);
	if(isset($_SESSION['user_name']))
		unset($_SESSION['user_name']);
	if(isset($_SESSION['user_mana']))
		unset($_SESSION['user_mana']);
	header('Location: ../common/home.php');
?>
